package com.itwn.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.itwn.entity.Movie;
import com.itwn.entity.actor;
import com.itwn.mapper.actorMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ActorService {
      @Autowired
      private actorMapper actorMapper;
    public PageInfo<actor> findActorPage(Integer pageNum, Integer pageSize, String actorName) {
        PageHelper.startPage(pageNum, pageSize);
        List<actor> list = actorMapper.selcetActorByPage(actorName);
        return new PageInfo<>(list);
    }

    public int addActor(actor actor) {
        return actorMapper.insert(actor);
    }

    public int updateMovie(actor actor) {
        return actorMapper.updateByPrimaryKey(actor);
    }

    public int removeById(int id) {
        return actorMapper.deleteByPrimaryKey(id);
    }
}
